//
//  KKUtils.h
//  KKUtils
//
//  Created by jay Win on 2019/10/16.
//  Copyright © 2019 jay Win. All rights reserved.
//


#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
#import <StoreKit/StoreKit.h>
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import <Photos/Photos.h>

NS_ASSUME_NONNULL_BEGIN
//相机权限的回调
typedef void(^KKPermissionRequestCompletionHandler)(BOOL hasPermisssion);
typedef void(^KKAssetCompletionHandler)(BOOL isSuccess, NSString* _Nullable assetLocalID, NSError* _Nullable error);
typedef void(^KKCompletionHandler)(BOOL isSuccess, NSError* _Nullable error);

/// 通用工具集合（非单例，自行控制生命周期）
@interface KKUtils : NSObject

/// 手机震动反馈功能
/// @param type 震动强弱类型 1 medium else heavy
-(void)vibrator:(int)type;

/// 发送Email
/// @param rootViewController 根视图控制器
/// @param recipients 收件人邮箱地址
/// @param subject 邮件标题
/// @param disPlayName 应用名
-(void)sendEmail:(UIViewController *)rootViewController emailAddress:(NSString *)recipients title:(NSString *)subject productName:(NSString *)disPlayName;

/// 展示商店评论会话框
-(void)showCommentDialog;

/// 复制字符串到剪切板
/// @param content 要复制的内容
-(void)copyStringToClipboard:(NSString *)content;

/// 检查是否安装了某个应用
/// @param urlSchemes 应用的Schemes
-(BOOL)hasInstallApp:(NSString *)urlSchemes;

//-(void)shareNative:(NSString *)filePath;

-(void)shareNative:(UIViewController*)rootViewController filePath:(NSString *)url;

/// 保存文件到相册
/// @param filePath 文件路径
- (void)saveToAlbum:(NSString *)filePath complete:(KKAssetCompletionHandler)handler;

/// 分享到instagrtam
/// @param filePath 要分享的文件路径
- (void)shareToInstagram:(NSString *)filePath complete:(KKCompletionHandler)handler;

/// 检查相机权限
-(BOOL)checkCameraPermission;
/// 检查相册权限
-(BOOL)checkAlbumPermission;
/// 请求相机权限
/// @param handler 请求结果回调
- (void)requestCameraPermission:(KKPermissionRequestCompletionHandler)handler;
/// 请求相册权限
/// @param handler 请求结果回调
- (void)requestAlbumPermission:(KKPermissionRequestCompletionHandler)handler;
/// 是否为iPhone X以上机型
/// @return 结果
-(BOOL)isIphoneXAbove;
/// 获取设备当前语言
-(NSString *)getLanguage;
/// 获取设备当前地区
-(NSString *)getLocale;
/// 是否为iPad
-(BOOL)isIPad;

/// 检查当前商店版本号（慎用，有圣核杯具风险）
/// @param appStoreID 商店id
/// @param titleText 弹窗标题
/// @param positiveButtonText 确认按钮标题
/// @param negativeButtonText 取消按钮标题
/// @param customMessage 自定义信息
-(void)checkUpdateAppVersion:(NSString *)appStoreID title:(NSString *)titleText positive:(NSString *)positiveButtonText negative:(NSString *)negativeButtonText message:(NSString *)customMessage;

@end

NS_ASSUME_NONNULL_END
